package com.xc.hotelmgr.webapi.modules.op.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xc.hotelmgr.webapi.common.utils.PageUtils;
import com.xc.hotelmgr.webapi.common.utils.Query;

import com.xc.hotelmgr.webapi.modules.op.dao.CommPriceDao;
import com.xc.hotelmgr.webapi.modules.op.entity.CommPriceEntity;
import com.xc.hotelmgr.webapi.modules.op.service.CommPriceService;


@Service("commPriceService")
public class CommPriceServiceImpl extends ServiceImpl<CommPriceDao, CommPriceEntity> implements CommPriceService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CommPriceEntity> page = this.page(
                new Query<CommPriceEntity>().getPage(params),
                new QueryWrapper<CommPriceEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public PageUtils sqlQuryPage(Map<String, Object> params) {
        String dtId = params.get("dtId").toString();
        IPage<CommPriceEntity> page = new Query<CommPriceEntity>().getPage(params);
        List<CommPriceEntity> list = baseMapper.sqlQuryPage(page,dtId);
        PageUtils pageUtils = new  PageUtils(page,list);
        return pageUtils;
    }

    @Override
    public List<CommPriceEntity> getByStoreId(Integer storeId) {
        return baseMapper.getAllByStoreId(storeId);
    }

}